﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using NX5Web.Utils;

namespace NX5Web.Controllers
{

    public class PB
    {
        public string v1 { get; set; }
    }

    public class PB2
    {
        public List<PB> vr { get; set; }
    }


    public class TestController : BaseApiController
    {
        // GET: api/Test/get
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET: api/Test/get/5
        public string Get(int id)
        {
            return "value";
        }

        // POST: apis/Test/Post
        [HttpPost]
        public string Post(PB2 pb2)
        {
            string ss = "==";
            if(pb2 != null)
            {
                foreach (var item in pb2.vr)
                {
                    ss += "," + item.v1;
                }
            }
            
            return ss;
        }

        // PUT: api/Test/Put/5
        public string Put(int id, [FromBody] PB pb)
        {
            return pb.v1;
        }

        // DELETE: api/Test/Delete/5
        public void Delete(int id)
        {
        }
    }
}
